package com.aiyan.edu.service.search;

import com.aiyan.edu.framework.interceptor.CanaryHeaderInterceptor;
import com.aiyan.edu.framework.interceptor.FeignClientInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author: zqzhou
 * @create: 2019/12/05 22:15
 **/
@Configuration
@EnableWebMvc
public class WebMvcAutoConfiguration extends WebMvcConfigurerAdapter {

    @Bean
    public FeignClientInterceptor feignClientInterceptor() {
        return new FeignClientInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new CanaryHeaderInterceptor());
    }
}
